{template 'common/header'}
<ul class="nav nav-tabs">
	<li><a href="{php echo $this->wurl('mem')}">会员列表</a></li>
	<li {if empty($op) || $op == 'display'}class="active"{/if}><a href="{php echo $this->wurl('mbook')}">会员课程列表</a></li>
	{if $op=='test'}<li class="active"><a href="{php echo $this->wurl('mbook',['op'=>'test','id'=>$id])}">测试列表</a></li>{/if}
	{if $op=='detail'}<li class="active"><a href="{php echo $this->wurl('mbook',['op'=>'detail','examid'=>$examid,'id'=>$id])}">测试详情</a></li>{/if}
</ul>
{if $op == 'display'}
<style>
th{
	text-align: center !important;
}
td{
	text-align: center !important;
	white-space: normal !important;
	word-break: break-all !important;
	vertical-align: middle !important;
}
</style>
<form action="" method="get" class="form-horizontal" role="form">
	<div class="panel panel-info">
        <div class="panel-heading">筛选</div>
		<div class="panel-body">
               <input type="hidden" name="c" value="site" />
               <input type="hidden" name="a" value="entry" />
               <input type="hidden" name="m" value="{php echo $this->modulename}" />
               <input type="hidden" name="do" value="mbook" />
			<div class="form-group">
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">会员昵称</label>
                <div class="col-xs-12 col-sm-2 col-lg-2">
                    <input class="form-control" name="nickname" type="text" value="{$nickname}" placeholder="">
                </div>
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">课堂名称</label>
                <div class="col-xs-12 col-sm-2 col-lg-2">
                    <input class="form-control" name="btitle" type="text" value="{$btitle}" placeholder="">
                </div>
               	<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"></label>
				<div class=" col-xs-12 col-sm-3 col-lg-3">
                      <button class="btn btn-sm btn-default" ><i class="fa fa-search"></i> 搜索</button>
				</div>
			</div>
		</div>
	</div>
</form>			
<div class="main">
	<div class="cate" style="background: white;">
		<table class="table table-hover">
			<thead>
				<tr>
					<th>ID</th>
					<th>会员</th>
					<th>课堂</th>
					<th>奖学金</th>
					<th>开课时间</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
			{loop $list $item}
				<tr>
					<td>{$item['id']}</td>
					<td><img src="{php echo toimage($mems[$item['mid']]['avatar'])}" style="width:80px;"><br>{$mems[$item['mid']]['nickname']}</td>
					<td>{$books[$item['bid']]['title']}</td>
					<td>{$item['price']}</td>
					<td>{php echo date('Y-m-d',$item['starttime'])}</td>
					<td>
						<a class="btn btn-sm btn-info" href="{php echo $this->wurl('mbook', array('op' => 'test', 'id' => $item['id']))}">测试结果</a>
					</td>
				</tr>
			{/loop}
			</tbody>
		</table>
		{$pager}
	</div>
</div>
{elseif $op=='test'}
<style>
th{
	text-align: center !important;
}
td{
	text-align: center !important;
	white-space: normal !important;
	word-break: break-all !important;
	vertical-align: middle !important;
}
</style>
<form action="" method="get" class="form-horizontal" role="form">
	<div class="panel panel-info">
        <div class="panel-heading">筛选</div>
		<div class="panel-body">
               <input type="hidden" name="c" value="site" />
               <input type="hidden" name="a" value="entry" />
               <input type="hidden" name="m" value="{php echo $this->modulename}" />
               <input type="hidden" name="do" value="mbook" />
               <input type="hidden" name="id" value="{$id}" />
               <input type="hidden" name="op" value="test" />
			<div class="form-group">
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">会员昵称</label>
                <div class="col-xs-12 col-sm-2 col-lg-2">
                    <input class="form-control" name="nickname" type="text" value="{$nickname}" placeholder="">
                </div>
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">课堂名称</label>
                <div class="col-xs-12 col-sm-2 col-lg-2">
                    <input class="form-control" name="btitle" type="text" value="{$btitle}" placeholder="">
                </div>
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">目录名称</label>
                <div class="col-xs-12 col-sm-2 col-lg-2">
                    <input class="form-control" name="dtitle" type="text" value="{$dtitle}" placeholder="">
                </div>
            </div>
            <div class="form-group">
               	<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"></label>
				<div class=" col-xs-12 col-sm-3 col-lg-3">
                      <button class="btn btn-sm btn-default" ><i class="fa fa-search"></i> 搜索</button>
				</div>
			</div>
		</div>
	</div>
</form>			
<div class="main">
	<div class="cate" style="background: white;">
		<table class="table table-hover">
			<thead>
				<tr>
					<th>ID</th>
					<th>会员</th>
					<th>课堂</th>
					<th>目录</th>
					<th>分数</th>
					<th>时间</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
			{loop $list $item}
				<tr>
					<td>{$item['id']}</td>
					<td><img src="{php echo toimage($mems[$item['mid']]['avatar'])}" style="width:80px;"><br>{$mems[$item['mid']]['nickname']}</td>
					<td>{$books[$item['bid']]['title']}</td>
					<td>{$directors[$item['did']]['title']}</td>
					<td>{$item['score']}</td>
					<td>{php echo date('Y-m-d',$item['createtime'])}</td>
					<td>
						<a class="btn btn-sm btn-info" href="{php echo $this->wurl('mbook', array('op' => 'detail','id'=>$id, 'examid' => $item['id']))}">详情</a>
					</td>
				</tr>
			{/loop}
			</tbody>
		</table>
		{$pager}
	</div>
</div>
{elseif $op=='detail'}
<style>
.exam-title{
	    text-align: right;
}
.exam-value{
	border: none;
    background: none;
    border-radius: 0;
    box-shadow: none;
}
.exam-sel{
	border:1px solid red;
}
.exam-right{
	border:1px solid green;
}
.help-block{
	color:red !important;
}
</style>
<div class="panel panel-default">
	<div class="panel-heading">测试详情</div>
	<div class="panel-body">
		<div class="panel-body" style="border: 1px solid #eee;margin-top: 15px;">
		<div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 exam-title">课程名称</label>
            <div class="col-sm-9 col-xs-12">
                <div class="form-control exam-value">{$book['title']}</div>
            </div>
        </div>
		<div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 exam-title">目录名称</label>
            <div class="col-sm-9 col-xs-12">
                <div class="form-control exam-value">{$directory['title']}</div>
            </div>
        </div>
		<div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 exam-title">测试分数</label>
            <div class="col-sm-9 col-xs-12">
                <div class="form-control exam-value">{$item['score']}分</div>
            </div>
        </div>
		<div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 exam-title">正确题数</label>
            <div class="col-sm-9 col-xs-12">
                <div class="form-control exam-value">{$item['num']}</div>
            </div>
        </div>
		<div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 exam-title">测试时间</label>
            <div class="col-sm-9 col-xs-12">
                <div class="form-control exam-value">{php echo date('Y-m-d H:i',$item['createtime'])}</div>
            </div>
        </div>
        
        <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 exam-title">温馨提示</label>
            <div class="col-sm-9 col-xs-12">
            	<div class="help-block">红色为会员所选错误答案，绿色是正确答案</div>
            </div>
        </div>
        </div>
        {loop $item['detail'] $k $row}
        <div class="panel-body" style="border: 1px solid #eee;margin-top: 15px;">
	        <div class="form-group">
	            <label class="col-xs-12 col-sm-3 col-md-2 exam-title">问题</label>
	            <div class="col-sm-9 col-xs-12">
	                <div class="form-control exam-value" style="font-weight:bold;">{$questions[$k]['title']}</div>
	            </div>
	        </div>
	        	{loop $questions[$k]['detail'] $kq $rq}
	        	<div class="form-group">
		            <label class="col-xs-12 col-sm-3 col-md-2 exam-title">选项</label>
		            <div class="col-sm-9 col-xs-12" style="margin-bottom: 15px;">
		                <div class="form-control exam-value {if $kq==$row['sels']}exam-sel{/if} {if $rq['issure']==1}exam-right{/if}">{$rq['title']}</div>
		            </div>
		        </div>
		        {/loop}
        </div>
        {/loop}
        
	</div>
</div>
	
{/if}

{template 'common/footer'}